<%@page import="java.rmi.Remote"%>
<%@ page language="java" import="java.util.*,mySql.*" pageEncoding="utf-8"%>
<%@ page contentType="text/html;charset=utf-8"%>
<%@ page import="show_shop.*" %>
<%@ page import="java.sql.PreparedStatement"%>
<%@ page import="java.sql.ResultSet"%>
<%@ page import="java.sql.Connection"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>  
  
    <title>order</title> 

	<link rel="stylesheet" type="text/css" href="../css/manage_date.css">
  

   

  </head>
  
 <body>
   <!-- header begin -->
   <div class="header">
	<div class="top-header">
	<div class="phone">
	<ul>
	<li class="tele"></li>
	<li class="telenum">
	<p>13739477470</p>
	</li>
	</ul>
	</div>
	
	<div class="logo">
	<h1><a href="http://localhost:8080/practise/jsp/manage_head.jsp">订单详情</a></h1>
	</div>
	
</div>
   </div>
   <!-- header end -->
   <%
   			
   			request.setCharacterEncoding("utf-8");
			response.setCharacterEncoding("UTF-8");
			
    %>
   <!-- banner begin -->
   <div class="top_banner">
   <div class="navigation">
   <ul>
   <b>
   <li><a href="http://localhost:8080/practise/jsp/manage_order.jsp">订单详情</a></li>
   <li><a href="http://localhost:8080/practise/jsp/manage_publish.jsp">商品发布</a></li>
   <li><a href="http://localhost:8080/practise/jsp/manage_delete.jsp">商品删除</a></li>
   </b>
   </ul>
   </div>
 		
   </div>
   <!-- banner end -->
   
   <!-- body_content begin -->
   <div class="all"> 
   	<div class="user"> 
   		<div class="order_left">
 				用户名：<%
 				out.print(new String(request.getParameter("id").getBytes("iso8859-1"), "utf-8"));
 				 %>
 			</div>		
   	</div>  	
   	<%
   		 String login_name="root";
			String login_password="2014121167";
			String driverClass="com.mysql.jdbc.Driver";
			String url="jdbc:mysql://localhost:3306/test";
			Connection con=null;
			PreparedStatement pst=null;
			ResultSet rs=null;
			user_bean delete_order=new user_bean();
			delete_order.setUsername(new String(request.getParameter("id").getBytes("iso8859-1"), "utf-8"));
			delete_order.setPassword(request.getParameter("id_1"));
			session.setAttribute("delete_order", delete_order);
			int k=0;
					ArrayList<order_form> user_order=new ArrayList<order_form>();
		
			DBConnection dbcon=new DBConnection(driverClass,url,login_password,login_name);
   			try
   			{
   					con=dbcon.getConnection();
   					pst=con.prepareStatement("select goods_name,goods_num,good_price from all_user_buy  Where user_name="+"'"+new String(request.getParameter("id").getBytes("iso8859-1"), "utf-8")+"'"+"and user_password="+"'"+request.getParameter("id_1")+"'");			
   					rs=pst.executeQuery();
   					
   					while(rs.next())
   					{
					order_form form=new order_form();
					form.setGoods_name(rs.getString("goods_name"));
					form.setGood_num(rs.getString("goods_num"));
					form.setPrice(rs.getString("good_price"));
					user_order.add(form);
   					}
   					session.setAttribute("user_order", user_order);		
   			}
   			catch (Exception e) {
				e.getStackTrace();
			}	
   	 %>
   	
   	
   	<!-- one  begin --> 	
   	<%
   			user_order=(ArrayList<order_form>)session.getAttribute("user_order");
   			int a=0,b=0,s=0;
		if(k<user_order.size())
		{   	
   	 %>  	
 	<div class="date_box">
 		<font size="+1">
 		<div class="font_i">
 			<div class="order_left">
 				商品名：<%=user_order.get(k).getGoods_name() %>
 			</div>
 			<div class="order_mid">
 				数量：<%=user_order.get(k).getGood_num() %>
			</div> 			
 			<div class="order_right">
 				价格：<%=user_order.get(k).getPrice() %>
 			</div>
 		</div>
 		</font>
 	</div>
 	<%
 	a=Integer.parseInt(user_order.get(k).getGood_num());
 	b=Integer.parseInt(user_order.get(k).getPrice());
 	s+=(a*b);
 	k++;
 	}
 	 %>
 	<!-- one end -->
 	
 	<!-- two begin -->
 	      	<%
   			user_order=(ArrayList<order_form>)session.getAttribute("user_order");
		if(k<user_order.size())
		{   	
   	 %>  	
 	<div class="date_box">
 		<font size="+1">
 		<div class="font_i">
 			<div class="order_left">
 				商品名：<%=user_order.get(k).getGoods_name() %>
 			</div>
 			<div class="order_mid">
 				数量：<%=user_order.get(k).getGood_num() %>
			</div> 			
 			<div class="order_right">
 				价格：<%=user_order.get(k).getPrice() %>
 			</div>
 		</div>
 		</font>
 	</div>
 	<%
 		a=Integer.parseInt(user_order.get(k).getGood_num());
 	b=Integer.parseInt(user_order.get(k).getPrice());
 	s+=(a*b);
 	k++;
 	}
 	 %>
 	<!-- two end -->
 	
 	<!-- three begin -->
    	<%
   			user_order=(ArrayList<order_form>)session.getAttribute("user_order");
		if(k<user_order.size())
		{   	
   	 %>  	
 	<div class="date_box">
 		<font size="+1">
 		<div class="font_i">
 			<div class="order_left">
 				商品名：<%=user_order.get(k).getGoods_name() %>
 			</div>
 			<div class="order_mid">
 				数量：<%=user_order.get(k).getGood_num() %>
			</div> 			
 			<div class="order_right">
 				价格：<%=user_order.get(k).getPrice() %>
 			</div>
 		</div>
 		</font>
 	</div>
 	<%
 	a=Integer.parseInt(user_order.get(k).getGood_num());
 	b=Integer.parseInt(user_order.get(k).getPrice());
 	s+=(a*b);
 	k++;
 	}
 	 %>
 	<!-- three end -->
 	
 	
 	
 	
 	
 	<!-- four begin -->
 	   	<%
   			user_order=(ArrayList<order_form>)session.getAttribute("user_order");
		if(k<user_order.size())
		{   	
   	 %>  	
 	<div class="date_box">
 		<font size="+1">
 		<div class="font_i">
 			<div class="order_left">
 				商品名：<%=user_order.get(k).getGoods_name() %>
 			</div>
 			<div class="order_mid">
 				数量：<%=user_order.get(k).getGood_num() %>
			</div> 			
 			<div class="order_right">
 				价格：<%=user_order.get(k).getPrice() %>
 			</div>
 		</div>
 		</font>
 	</div>
 	<%
 	a=Integer.parseInt(user_order.get(k).getGood_num());
 	b=Integer.parseInt(user_order.get(k).getPrice());
 	s+=(a*b);
 	k++;
 	}
 	 %>
 	<!-- four end -->
 	
 	<!-- five begin -->
 	   	<%
   			user_order=(ArrayList<order_form>)session.getAttribute("user_order");
		if(k<user_order.size())
		{   	
   	 %>  	
 	<div class="date_box">
 		<font size="+1">
 		<div class="font_i">
 			<div class="order_left">
 				商品名：<%=user_order.get(k).getGoods_name() %>
 			</div>
 			<div class="order_mid">
 				数量：<%=user_order.get(k).getGood_num() %>
			</div> 			
 			<div class="order_right">
 				价格：<%=user_order.get(k).getPrice() %>
 			</div>
 		</div>
 		</font>
 	</div>
 	<%
 	a=Integer.parseInt(user_order.get(k).getGood_num());
 	b=Integer.parseInt(user_order.get(k).getPrice());
 	s+=(a*b);
 	k++;
 	}
 	 %>
 	<!-- five end -->
 	<div class="price">
 		总价： <%=s %>
 	</div>
 	<div class="delete">
 		<a  href="http://localhost:8080/practise/jsp/delete_order.jsp">订单删除</a>
 	</div>

  </div>
   
   <!-- body_content end -->
   
   <!-- bottom begin -->
   <div class="bottom_show">
   <div class="picture_1">
 	<a href="#"></a>
   </div>
   <div class="picture_2">
 <a href="#"></a>
   </div>   
   <div class="picture_3">
  <a href="#"></a>
   </div>
    <div class="picture_4">
  <a href="#"></a>
   </div>
   
   
   </div>
      <div class="bottom_bar"></div>
   <div class="bottom_word">
	<p>航空港校区 | 四川省成都市西南航空港经济开发区学府路一段24号 | 右边610225 | 电话:028-85966502</p>
	<p>龙泉校区 | 成都市龙泉驿阳光城幸福路10号 | 邮编:610103 | 电话:028-84833333</p>
	<p>Copyringht 2003_2014 成都信息工程大学 建议使用IE8.0,1034*860以上浏览</p>
   </div>
   <!-- bottom end -->
   
  </body>
</html>
